home *** CD-ROM | disk | FTP | other *** search
/ Travel Adventure! / Travel Adventure!.iso / pc / _bbs / pcbtool / dirlst.c < prev    next >
Text File  |  1994-04-13  |  1KB  |  61 lines

  1. /*
  2.  * build pcboard dir.lst
  3.  */
  4.  
  5. #include <ctype.h>
  6. #include <string.h>
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9.  
  10. #if 0
  11. 123456789012345678901234567890
  12. J:\BBS\PCB\ADA                
  13. 12345678901234567890123456789012345678901234567890123456789012345
  14. E:\MSDOS\ADA\                                                    
  15. #endif
  16.  
  17. #include <stdio.h>
  18.  
  19. /*
  20.  * description file, directory where files are, directory description
  21.  */
  22. void _Cdecl
  23. main(int argc, char *argv[]) {
  24.     char buf[200];
  25.     char buf1[80];
  26.     char buf2[80];
  27.     char buf3[80];
  28.     int len;
  29.     char *p;
  30.     
  31.     strcpy(buf1, argv[1]);
  32.     buf1[30] = '\0';
  33.     strcpy(buf2, argv[2]);
  34.     buf2[30] = '\0';
  35.  
  36.     len = strlen(argv[3]);
  37.     if (!len) {
  38.         fprintf(stderr, "dirlst: no area path found.\n");
  39.         exit(1);
  40.     }
  41.  
  42.     buf3[0] = '\0';
  43.     while (NULL != gets(buf)) {
  44.         if (0 == strncmpi(argv[3], buf, len)) {
  45.             p = buf + len;
  46.             while (isspace(*p))
  47.                 ++p;
  48.             strcpy(buf3, p);
  49.             buf3[35] = '\0';
  50.             break;
  51.         }
  52.     }
  53.     if (! buf3[0]) {
  54.         fprintf(stderr, "no area found:\n%s\n", argv[3]);
  55.         exit(1);
  56.     }
  57.     
  58.     printf("%-30s%-30s%-35s", buf1, buf2, buf3);
  59.     exit(0);
  60. }
  61.